1. Field of Invention
This invention relates to a method of digital image processing, which particularly relates to the image processing for enlarging/reducing digital images on a computer display or the device having a LCD display uniformly and smoothly.
2. Related Art
When the image on the computer display is too large or small to display or to be processed, then it may be necessary to be reduced or enlarged. For the raster image, it is made of a plurality of pixels. For example, the image on the display comprises a plurality of light pixels, and the versatile color combinations of pixels constitute the entire digital image. Since the number of pixels in an image is fixed and finite, the process for enlarging, reducing or rotating the image may effect its resolution and come into image distortion. Generally, the image scale conversion processing of a digital image is carried out by deleting or inserting the image pixels uniformly. But, if the enlargement or reduction processing of a digital image is just simply carried out by inserting the most adjacent pixels or deleting pixels without advanced processing, then the resulted images will inevitably be involved with the mosaic effect or deformity.
Consequently, for processing the image scale conversion on a gray-scale or a full color digital image, the bilinear interpolation method or the high-order interpolation method is commonly used to improve the conversion effect. However, the former will still have the mosaic effect or deformity for the high frequency images, and the latter is unsuitable for high speed processing.
To overcome the effects mentioned above, the object of the present invention provides a method capable of enlarging/reducing digital images uniformly and smoothly. The image scale conversion processing can also be achieved at a high speed.
According to the above objective of the present invention, the proposed image scale conversion processing of digital images can be briefly described in the following two steps.
(1) Determine the positional coordinates of each of the new image pixels and the corresponding region of the original image pixels within the reference frame. The process is carried out based on the regional mapping method according to magnifications of the image scale conversion on the original image on horizontal direction and vertical direction to convert the positional coordinates of each original image pixel (referred to hereinafter as function f) to the positional coordinates of the new image pixels (referred to hereinafter as function g), respectively.
(2) Determine the data values of the new image pixels after the image scale conversion processing. For the reduction process, portions of the original image pixels are discarded without mapping to the new image, and the data value of the new image pixel g is calculated from the average value of the original image pixel f, In addition, the pixels adjacent to the pixel f are not mapped to the new image. Whereas the pixels mapped to the pixel g constitutes a rectangular region in the original image, in which pixel f is placed at the upper-left point. For the enlargement processing, parts of the new image pixels are not mapped from the original image pixels but the additional pixels. Each rectangular region, comprising of four adjacent pixels of the original image, are mapped to a larger rectangular region in the new image (the vertical and horizontal length are assumed to be W and H, respectively). Of which the data values of the new image pixels are calculated based on the four original image pixels using the method similar to the interpolation and are calculated on principle inversely proportional to the distance. The practical calculation is carried out in detail as follow:
1. Sequentially calculate the vertical and horizontal distances dx and dy between one of the new image pixels in the rectangular region and each of the corners of the rectangular region, respectively.
2. Use the value of (Wxe2x88x92dx)+(Hxe2x88x92dy) as a weight to calculate the weighted average data values of the new image pixels based on the four original image pixels within the square region to obtain the data value of such pixel.
3. Similarly calculate the data values of the other pixels in the rectangular region from the first step.
Accordingly, if a digital image is subjected to reduction or enlargement on horizontal and vertical directions, the resulting image can be easily obtained according to the prior art. However, consider a situation in which a digital image is subjected to reduction on horizontal direction and enlargement on vertical direction, or it is subjected to enlargement on horizontal direction and reduction on vertical direction. Under this situation, a temporary image constructed form the original image must be produced according to the magnification of the image scale conversion on the horizontal direction while the magnification on the vertical direction is kept in unity. Consequently, using the similar procedure mentioned above, the new image could be constructed from the temporary image according to the magnification of the image scale conversion on vertical direction while the magnification on the horizontal direction is kept in unity.
Certainly, the processing sequence of the image scale conversion on horizontal direction and vertical direction can be altered, and similarly the processing order of enlargement and reduction can also be altered.
Further scope of applicability of the present invention will become apparent from the detailed description given hereinafter. However, it should be understood that the detailed description and specific examples, while indicating preferred embodiments of the invention, are given by way of illustration only, since various changes and modifications within the spirit and scope of the invention will become apparent to those skilled in the art from this detailed description.